package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.system.domain.TbComponentinfo;
import com.ruoyi.system.domain.TbTest;
import com.ruoyi.system.mapper.TbComponentinfoMapper;
import com.ruoyi.system.mapper.TbTestMapper;
import com.ruoyi.system.service.ITbComponentinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * 基础数据Service业务层处理
 *
 * @author wf
 * @date 2021-09-07
 */
@Service
public class TbComponentinfoServiceImpl implements ITbComponentinfoService {

    @Autowired
    private TbComponentinfoMapper tbComponentinfoMapper;

    @Autowired
    private TbTestMapper tbTestMapper;

    /**
     * 查询
     */
    @Override
    public TbComponentinfo selectTbComponentinfoById(Integer id) {
        return tbComponentinfoMapper.selectTbComponentinfoById(id);
    }

    /**
     * 查询列表
     */
    @Override
    public List<TbComponentinfo> selectTbComponentinfoList(TbComponentinfo tbComponentinfo) {
        return tbComponentinfoMapper.selectTbComponentinfoList(tbComponentinfo);
    }

    /**
     * 新增
     */
    @Override
    public int insertTbComponentinfo(TbComponentinfo tbComponentinfo) {
        return tbComponentinfoMapper.insertTbComponentinfo(tbComponentinfo);
    }

    /**
     * 修改
     */
    @Override
    public int updateTbComponentinfo(TbComponentinfo tbComponentinfo) {
        return tbComponentinfoMapper.updateTbComponentinfo(tbComponentinfo);
    }

    /**
     * 批量删除
     */
    @Override
    public int deleteTbComponentinfoByIds(String ids) {
        tbTestMapper.deleteTestByComponentinfoIds(Convert.toStrArray(ids));
        return tbComponentinfoMapper.deleteTbComponentinfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除信息
     */
    @Override
    public int deleteTbComponentinfoById(Integer id) {
        return tbComponentinfoMapper.deleteTbComponentinfoById(id);
    }

    /**
     * 查询测试站以及数量
     */
    @Override
    public List<HashMap<String, Integer>> selectRegisterNoAndCount(TbComponentinfo tbComponentinfo) {
        return tbComponentinfoMapper.selectRegisterNoAndCount(tbComponentinfo);
    }

    /**
     * 查询配件以及数量
     */
    @Override
    public List<HashMap<String, Integer>> partAndCountList(TbComponentinfo tbComponentinfo) {
        return tbComponentinfoMapper.partAndCountList(tbComponentinfo);
    }

    @Override
    public List<String> selectStationNameList() {
        return tbComponentinfoMapper.selectStationNameList();
    }

    @Override
    public List<String> selectReportNoList() {
        return tbComponentinfoMapper.selectReportNoList();
    }

    @Override
    public List<String> selectRegisterNoList() {
        return tbComponentinfoMapper.selectRegisterNoList();
    }

    @Override
    public List<String> selectDeviceNameList() {
        return tbComponentinfoMapper.selectDeviceNameList();
    }

    @Override
    public List<String> selectPartNoList() {
        return tbComponentinfoMapper.selectPartNoList();
    }

    @Override
    public List<String> selectPartSerialNoListList() {
        return tbComponentinfoMapper.selectPartSerialNoListList();
    }

    @Override
    public List<String> selectModelList() {
        return tbComponentinfoMapper.selectModelList();
    }

    @Override
    public List<String> selectManufacturerList() {
        return tbComponentinfoMapper.selectManufacturerList();
    }

    @Override
    public List<HashMap<String, Integer>> selectComponentinfoNoAndCount(TbComponentinfo tbComponentinfo) {
        return tbComponentinfoMapper.selectComponentinfoNoAndCount(tbComponentinfo);
    }
}
